$(document).on('pageshow', '#sp', function(){
	var imageWidth = $('#spImage').width();
	$('#spImage').height(imageWidth);
	$('#spImage').find('img').width(imageWidth);
	$('#spImage').find('img').height(imageWidth);
	$('#spTitle').height(imageWidth);
	var titleHeight = $('#spTitle').height();
	
	var titleCount = $('#spTitle').find('p').size();
	console.log(titleCount);
	$('#spTitle').css('line-height', titleHeight / titleCount + 'px');
});

$(document).on('pageinit', function(){
	//判断是否微信浏览器
	var useragent = navigator.userAgent.toLowerCase();
	if(useragent.match(/MicroMessenger/i) != "micromessenger"){
		//window.location.href = '../index.html';
	}
	
	//隐藏微信右上角和导航条
	function onBridgeReady(){
		WeixinJSBridge.call('hideOptionMenu');
		WeixinJSBridge.call('hideToolbar');
	}
	if (typeof WeixinJSBridge == "undefined"){
		if( document.addEventListener ){
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}else if (document.attachEvent){
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}else{
		onBridgeReady();
	}
});